package cn.edu.swpu.cins.u_chain.frontend.dao.user;

import cn.edu.swpu.cins.u_chain.frontend.entity.dto.user.ContactInfoDetail;
import cn.edu.swpu.cins.u_chain.frontend.entity.dto.user.UpdateRole;
import cn.edu.swpu.cins.u_chain.frontend.entity.dto.user.ContactInfoView;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.City;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.County;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.Province;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.user.BasicInfo;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.user.ContactInfoDB;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.user.LocationInfo;
import cn.edu.swpu.cins.u_chain.frontend.entity.persistence.user.UserPublic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserDao {

    int addUser(UserPublic user);

    int updateRole(UpdateRole updateRole);

    int updatePwd(@Param("id") int id, @Param("pwd") String pwd);

    UserPublic selectUserByPhone(String phoneNum);

    UserPublic selectUserByPwd(int id);

    int addBasicInfo(BasicInfo basicInfo);

    //用户添加地理位置信息
    int addLocationInfo(LocationInfo locationInfo);

    int addContactInfo(ContactInfoDB contactInfoDB);

    BasicInfo selectBasicInfo(int userId);

    ContactInfoDetail selectContactInfo(int userId);

    int updateMail(@Param("userId") int userId, @Param("mail") String mail);

    //用户上传头像成功后修改头像地址
    int updateImage(@Param("userId") int userId, @Param("path") String path);

    int updateBasic(BasicInfo basicInfo);

    int updateContactInfo(ContactInfoDB contactInfoDB);

    List<County> selectAllCountyByCityId(String cityId);

    List<City> selectAllCityByProvinceId(String provinceId);

    List<Province> selectAllProvince();

}
